#include <stdio.h>

int query9(int a);
int main(void)
{
	int num;
	num = query9(100);
	printf("The number of 9 in 1~100 is %d.\n",num);
	return 0;
}


int query9(int a)
{
	int i = 1;
	int result = 0;
	int ones, tens;
	while(i <= a)
	{
		ones = i % 10;
		tens = (i/10)%10;
		if(ones == 9)
			result++;
		if(tens == 9)
			result++;
		i++;
	}
	return result;
}
